package es.christiangarcia.android.pokepedia.model.db;

import android.database.sqlite.SQLiteDatabase;
import android.provider.BaseColumns;
import android.util.Log;

public class TypeTable implements BaseColumns {

	public static final String TABLE_NAME = "attack";

	public static final String NAME_COLUMN = "name";

	//@formatter:off
	public static final String[] ALL_COLUMNS = {
			_ID,
			NAME_COLUMN
	};
	public static final String DATABASE_CREATE = "CREATE TABLE " 
		+ TABLE_NAME
		+ " ("
		+ TypeTable._ID + " INTEGER PRIMARY KEY,"
		+ TypeTable.NAME_COLUMN + " TEXT UNIQUE,"
		+ ");";
	// @formatter:on

	public static void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}

	public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
		Log.w(TypeTable.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion
				+ ", which will destroy all old data");
		database.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(database);
	}
}